/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package vn.edu.thptduongbachmai.DbUtil;

/**
 *
 * @author Son
 */
public class Order {
    private boolean _ascending;
    private String _propertyName;
    protected Order(String propertyName, boolean ascending) {
        _ascending = ascending;
        this._propertyName = propertyName;
    }

  
    public static Order asc(String propertyName) {
        return new Order(propertyName, true);
    }
    public static Order desc(String propertyName)
    {
        return  new Order(propertyName, false);
    }

    @Override
    public String toString() {
        String result = " Order by "+_propertyName +" ";
        if (_ascending)
            return result+"asc ";
        return result + "desc ";
    }
    
}
